import java.util.Arrays;
import java.util.Scanner;

/**
 * 牛客 mkdir
 * https://www.nowcoder.com/questionTerminal/433c0c6a1e604a4795291d9cd7a60c7a
 */
public class Demo2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        //循环接收多组测试用例
        while (sc.hasNext()) {
            int n = sc.nextInt();
            String[] path = new String[n];
            for (int i = 0; i < n; i++) {
                path[i] = sc.next();
            }
            //按照字典的顺序进行排序
            Arrays.sort(path);
            //过滤相同目录 || 子目录
            //伪删除法: 标记
            boolean[] flg = new boolean[n];
            for (int i = 0; i < n-1; i++) {
                //相同目录
                if(path[i].equals(path[i+1])) {
                    flg[i] = true;//伪删除
                }else if(path[i].length() < path[i+1].length()
                && path[i+1].contains(path[i]) && path[i+1].charAt(path[i].length()) == '/')
                   flg[i] = true;
            }
            //拼接要输出的结果
            for (int i = 0; i < n; i++) {
                //最后输出看 是否被剔除 如果是 false 表示未被剔除
                if(!flg[i]){
                    System.out.println("mkdir -p " + path[i]);
                }
            }
            //注意换行
            System.out.println();
        }

    }
    //方法二
     public static void main2(String[] args) {
                Scanner sc = new Scanner(System.in);
                while(sc.hasNext()){
                    int n = sc.nextInt();
                    String[] str = new String[n];
                    for(int i = 0; i < n; i++){
                        str[i] = sc.nextLine();
                    }
                    // 排序以达到按照字典顺序
                    Arrays.sort(str);
                    for(int i = 1; i < n; i++){
                        // 排完序后最接近的字符串就会相邻
                        // 若后者是在前者的路径之后延伸（即为/a/ab和/a/ab/abc的关系）
                        // 就将前者变为""以便后续打印时判断，需要注意（/a/ab和/a/abc）这种情况
                        if(str[i].contains(str[i-1]) && str[i].charAt(str[i-1].length()) == '/'){
                            str[i-1] = "";
                        }
                    }
                    for(int i = 0; i < n; i++){
                        if(!"".equals(str[i])){
                            System.out.println("mkdir -p "+str[i]);
                        }
                    }
                    System.out.println();
                }
            }
        }


